export type payItem = {
    val: string;
    icon: React.ReactNode;
    iconColor: string;
    text: string;
    isChecked: boolean;
};
import { useState } from 'react';
const payList = [
    { val: 'wechat', icon: <>&#xe650;</>, iconColor: '#0CC160', text: '微信支付', isChecked: true },
    { val: 'alipay', icon: <>&#xe634;</>, iconColor: '#1578FF', text: '支付宝', isChecked: false },
    { val: 'other', icon: <>&#xe631;</>, iconColor: '#B3B9C4', text: '三方支付', isChecked: false },
];
export const usePayList = () => {
    const [paylistArr, setPayListArr] = useState(payList);
    const [disCountCode, setDisCountCode] = useState(null);
    return {
        paylistArr,
        setPayListArr,
        disCountCode,
        setDisCountCode,
    };
};

export const changePayStatus = (paylistArr: payItem[], setPayListArr, item: string) => {
    let newArr = paylistArr.map((current) => {
        if (current.val == item) {
            current.isChecked = true;
        } else {
            current.isChecked = false;
        }
        return current;
    });
    setPayListArr(newArr);
};
